<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>设置标题</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="../../../../assets/css/reset.css"/>

    <link rel="stylesheet" href="../../../../assets/css/examples.css"/>

</head>
<body>
<h1>
    设置标题（setHeader）
</h1>

<ul>
    <li>
        <a href="javascript:void(0)" id="noHeader">空头部</a>
    </li>
    <li>
        <a href="javascript:void(0)" id="onlyTitle">只有标题</a>
    </li>
    <li>
        <a href="javascript:void(0)" id="onlyBack">只有返回</a>
    </li>
    <li>
        <a href="javascript:void(0)" id="onlyClose">只有关闭</a>
    </li>
    <li>
        <a href="javascript:void(0)" id="titleAndBack">标题＋返回</a>
    </li>
    <li>
        <a href="javascript:void(0)" id="titleAndClose">标题＋关闭</a>
    </li>
    <li>
        <a href="javascript:void(0)" id="titleAndBackAndClose">标题＋返回＋关闭</a>
    </li>
</ul>

<script  src="../../../../../core/$$.js"></script>
<script  src="../../../../../core/libs/zepto/zepto.min.js"></script>
<script  src="../../../../../core/libs/zepto/selector.js"></script>
<script  src="../../../../../core/libs/zepto/touch.js"></script>
<script  src="../../../../../core/libs/underscore-min.js"></script>
<script  src="../../../../../core/libs/oop.js"></script>
<script  src="../../../../../core/extend/prototype.js"></script>
<script  src="../../../../../core/extend/function.js"></script>
<script  src="../../../../../core/native/platformAdapter.js"></script>
<script  src="../../../../../core/native/api.js"></script>
<script  src="../../../../../core/native/eventListener.js"></script>
<script  src="../../../classes/XX.js"></script>
<script  src="../../../classes/common.js"></script>
<script  src="../../../../config/url/dev.js"></script>

<script type="text/javascript">
    var title = 'setHeader Test';

    $('#noHeader').on('tap', function () {
        $$.Native.setHeader({});
    });

    $('#onlyTitle').on('tap', function () {
        $$.Native.setHeader({
            isBack:false,
            title: title
        });
    });

    $('#onlyBack').on('tap', function () {
        $$.Native.setHeader({
            isBack: true,
            backCallback: function () {
                alert('触发返回（只有返回）,确定之后，返回上一个页面');
                $$.Native.back();
            }
        });
    });

    $('#onlyClose').on('tap', function () {
        $$.Native.setHeader({
            isClose: true,
            closeCallback: function () {
                alert('触发关闭（只有关闭）');
                $$.Native.back();
            }
        });
    });

    $('#titleAndBack').on('tap', function () {
        $$.Native.setHeader({
            title: title,
            isBack: true,
            backCallback: function () {
                alert('触发返回（标题＋返回）');
                $$.Native.back();
            }
        });
    });

    $('#titleAndClose').on('tap', function () {
        $$.Native.setHeader({
            title: title,
            isClose: true,
            closeCallback: function () {
                alert('触发关闭（标题＋关闭）');
                $$.Native.back();
            }
        });
    });

    $('#titleAndBackAndClose').on('tap', function () {
        $$.Native.setHeader({
            title: title,
            isBack: true,
            backCallback: function () {
                alert('触发返回（标题＋返回＋关闭）');
                $$.Native.back();
            },
            isClose: true,
            closeCallback: function () {
                alert('触发关闭（标题＋返回＋关闭）');
            }
        });
    });
</script>
</body>
</html>